package common_services

import (
	"ginServer/modules/common/global/consts"
	"ginServer/modules/common/utils/response"

	"github.com/gin-gonic/gin"
)

type CommonService struct{}

// 列表获取成功
func (s CommonService) IndexApiSuccess(c *gin.Context, data interface{}) {
	response.Success(c, consts.CurdStatusOkMsg, data)
}

// 添加成功
func (s CommonService) AddApiSuccess(c *gin.Context) {
	response.Success(c, consts.CurdCreatOkMsg, "")
}

// 添加失败
func (s CommonService) AddApiError(c *gin.Context) {
	response.Fail(c, consts.CurdCreatFailCode, consts.CurdCreatFailMsg, "")
}

// 修改成功
func (s CommonService) UpdateApiSuccess(c *gin.Context) {
	response.Success(c, consts.CurdUpdateOkMsg, "")
}

// 修改失败
func (s CommonService) UpdateApiError(c *gin.Context) {
	response.Fail(c, consts.CurdUpdateFailCode, consts.CurdUpdateFailMsg, "")
}

// 删除成功
func (s CommonService) DeleteApiSuccess(c *gin.Context) {
	response.Success(c, consts.CurdDeleteOkMsg, "")
}

// 删除失败
func (s CommonService) DeleteApiError(c *gin.Context) {
	response.Fail(c, consts.CurdDeleteFailCode, consts.CurdDeleteFailMsg, "")
}

// 调整成功
func (s CommonService) AdjustApiSuccess(c *gin.Context) {
	response.Success(c, consts.CurdAdjustOkMsg, "")
}

// 调整失败
func (s CommonService) AdjustApiError(c *gin.Context) {
	response.Fail(c, consts.CurdAdjustFailCode, consts.CurdAdjustFailMsg, "")
}
